﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DeadDog;

namespace SC2parser.Parsing
{
    /// <summary>
    /// Buffer to store webpages in
    /// </summary>
    public class SCBuffer : HTMLBuffer<HTMLPage>
    {
        /// <summary>
        /// HTMLbuffer to save time when fetching the same webpage several times
        /// </summary>
        /// <param name="filepath"></param>
        public SCBuffer(string filepath)
            : base(filepath)
        {
        }

        /// <summary>
        /// Reads the html of an url
        /// </summary>
        /// <param name="url">The url to read</param>
        /// <returns>The read html</returns>
        public string ReadURL(string url)
        {
            return base.ReadURL(url).HTML;
        }

        protected override HTMLPage Convert(string html, URL request, URL response)
        {
            return new HTMLPage(html, request, response);
        }
    }
}
